@extends('layouts.layouts')
@section('title')
    <title>后台首页-客户评论</title>
    <style>
      .autocut{cursor:pointer;}
    </style>
@endsection
@section('content')
    <div class="modal small fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3 id="myModalLabel">Delete Confirmation</h3>
                </div>
                <div class="modal-body">
                    <p class="error-text"><i class="fa fa-warning modal-icon"></i>Are you sure you want to delete the user?<br>This cannot be undone.</p>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
                    <button class="btn btn-danger" data-dismiss="modal">Delete</button>
                </div>
            </div>
        </div>
    </div>
    <div class="content">
        <div class="header">
            <h1 class="page-title">pt后台管理</h1>
            <ul class="breadcrumb">
                <li><a href="/user/list">用户列表</a> </li>
                <li class="active">用户详情</li>
            </ul>
        </div>
        
        <div class="main-content">
          <div class="row">
                <div class="col-md-4">
                    <form class="form-horizontal">
                      <div class="form-group">
                        <label class="col-sm-3 control-label">昵称：</label>
                        <div class="col-sm-6">
                          <p class="form-control-static">{{$user->name}}</p>
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label">性别：</label>
                        <div class="col-sm-6">
                          <p class="form-control-static">{{$user->sex}}</p>
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label">手机号：</label>
                        <div class="col-sm-6">
                          <p class="form-control-static">{{$user->mobile}}</p>
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label">状态：</label>
                        <div class="col-sm-6">
                           @if($user->status==1)
                            <p class="form-control-static">正常</p>
                           @else
                            <p class="form-control-static">已封禁</p>
                           @endif
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="col-sm-3 control-label">荣誉状态：</label>
                        <div class="col-sm-6">

                          <p class="form-control-static">老师荣誉</p>
                        </div>
                      </div>
                    </form>  
                </div>
                <div class="col-md-3">
                    <form class="form-horizontal">
                      <div class="form-group">
                        <label class="col-sm-3 control-label">头像：</label>
                        <div class="col-sm-6">
                          <p class="form-control-static">
                            <img src="{{$user->avatar}}" alt="{{$user->name}}" class="img-thumbnail">
                          </p>
                        </div>
                      </div>
                    </form>  
                </div>
                <div class="col-md-5">
                  <div class="row">
                    <div class="col-sm-3">
                        <h4 class="bigger lighter">输出内容/篇</h4>
                        <div class="widget-body">
                              <small>{{sum_content($user_id)}}</small>
                        </div>
                    </div>  
                    <div class="col-sm-3">
                        <h4 class="bigger lighter">输出评论/条</h4>
                        <div class="widget-body">
                              <small>{{sum_comment($user_id)}}</small>
                        </div>
                    </div>
                    <div class="col-sm-3">
                        <h4 class="bigger lighter">人气值</h4>
                        <div class="widget-body">
                              <small>888</small>
                        </div>
                    </div>  
                    <div class="col-sm-3">
                        <h4 class="bigger lighter">收入/元</h4>
                        <div class="widget-body">
                              <small>{{sum_user_add($user_id)}}</small>
                        </div>
                    </div>
                  </div>
                  <div class="row" style="margin-top:30px;">
                    <button type="button" class="btn btn-primary">授予荣誉</button>
                    <button type="button" class="btn btn-success">个人主页</button>
                    <button type="button" class="btn btn-danger">&nbsp;&nbsp;封禁&nbsp;&nbsp;</button>
                  </div>
                </div>
          </div>
          <div class="row">
                <div class="col-sm-12 col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading no-collapse">
                          <div class="btn-group btn-group-lg">
                              <a href="/user/detailarticle/{{$user_id}}" class="btn btn-default">文章</a>
                              <a href="/user/userdetail/{{$user_id}}" class="btn btn-default">课程</a>
                              <a href="/user/detailarticle/{{$user_id}}" class="btn btn-default">训练计划</a>
                              <a href="javascript:;" class="btn btn-default active">评论</a>
                              <a href="/user/detailfinancerecord/{{$user_id}}" class="btn btn-default">流水</a>
                              <a href="/user/detailarticle/{{$user_id}}" class="btn btn-default">提现</a>
                              <a href="/user/detailarticle/{{$user_id}}" class="btn btn-default">圈子</a>
                          </div>
                        </div>
                        <table class="table table-bordered table-striped">
                          <thead>
                            <tr>
                              <th width="10%">编号</th>
                              <th width="10%">标题</th>
                              <th width="10%">评论内容</th>
                              <th width="10%">分数</th>
                              <th width="10%">评论者</th>
                              <th width="10%">创建时间</th>
                              <th width="10%">最后操作</th>
                              <!-- <th width="10%">操作</th> -->
                            </tr>
                          </thead>
                          <tbody>
                             @foreach($list as $item)
                            <tr>
                              <th>{{$item->id}}</th>
                              <th>{{$item->title}}</th>
                              <th class="autocut" data-attr="{{$item->content}}">点击查看</th>
                              <th>{{$item->score}}</th>
                              <th>{{$user->name}}</th>
                              <th>{{$item->created_at}}</th>
                              <th>--</th>
                              <!-- <th>{{$item->title}}</th> -->
                            </tr>
                             @endforeach
                          </tbody>
                        </table>
                    </div>
                </div>
            </div> 
            {{$list->render()}}   
        </div>
    </div>

    <script type="text/javascript">
        $(document).ready(function(){
            //提交信息
            $("#submit_form_add").click(function(){
                var data = $("#tab2").serialize();
                data = decodeURIComponent(data,true);
                $.ajax({
                    type:"POST",
                    url:"/banner/insert",
                    data:data,
                    dataType:'json',
                    success:function(result){
                        console.log(result);
                        if(result.code==1){
                            location.href='/banner/list';
                        }else{
                            alert(result.msg);
                        }
                    }
                });
            });
        })
    </script>
    <script type="text/javascript">
            $(".autocut").click(function(){
                var obj = $(this);
                var data = obj.attr("data-attr");
                swal(data);
            })
    </script>
@endsection